package com.qfedu.scode.util;

import com.qfedu.scode.config.RedisKeyConfig;

/**
 * @program: StartCoding
 * @description:
 * @author: Feri(邢朋辉)
 * @create: 2021-01-09 10:06
 */
public class TokenUtil {
    /**
     * 通过令牌获取用户信息*/
    public static int getUid(String token){
        if(StringUtil.isNoEmpty(token)){
            String key= RedisKeyConfig.LOGIN_TOKEN+token;
            if(RedissonUtil.isHave(key)){
                return Integer.parseInt(RedissonUtil.getStr(key));
            }
        }
        return -1;
    }
}
